<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>大奔农庄</title>
    <link rel="stylesheet" type="text/css" href="../../css/aui.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/style.css"/> 
    <link rel="stylesheet" href="../../css/swiper.min.css">
    <link rel="stylesheet" href="../../font/iconfont.css">
</head>
<body>
	<div class="swiper-container">
	    <div class="swiper-wrapper" id="shenghuoSlider">
	    <!--
	        <div class="swiper-slide"><img src="../../image/yshi-1.jpg" width="100%" ></div>
	        <div class="swiper-slide"><img src="../../image/yshi-1.jpg" width="100%" ></div>
	    -->
	    </div>
	</div>
	<div class="aui-bar aui-bar-bt aui-bar-btn-full" id="shenghuoCate">
	<!--
	    <div class="aui-bar-btn-itemm cd_shaixuan zhmx-active" tapmode="" data-item-order="0" onclick="shaixuan(this,1);">写真留念</div>
	    <div class="aui-bar-btn-itemm cd_shaixuan " tapmode="" data-item-order="1" onclick="shaixuan(this,2);">婚纱照</div>
	    <div class="aui-bar-btn-itemm cd_shaixuan" tapmode="" data-item-order="2" onclick="shaixuan(this,3);">私人订制</div>
	    <div class="aui-bar-btn-itemm cd_shaixuan" tapmode="" data-item-order="2" onclick="shaixuan(this,3);">微V</div>
	    <div class="aui-bar-btn-itemm cd_shaixuan" tapmode="" data-item-order="2" onclick="shaixuan(this,3);">MV</div>
	-->
	</div>
	<div class="aui-padded-15" id="shenghuoList">
		<!--内容列表
		<div class="aui-content aui-margin-b-15 jinrong-yy">
		    <ul class="aui-list aui-media-list">
		        <li class="aui-list-item" onclick="openXinxiinfo();">
		            <div class="aui-media-list-item-inner">
			            <div class="aui-list-item-jinr aui-col-xs-5">
		                    <img src="../../image/yshi-2.jpg">
		                </div>
		                <div class="aui-list-item-inner aui-col-xs-7">
		                    <div class="aui-list-item-text">
		                        <div class="aui-list-item-title">韩式小清新唯美婚纱照</div>
		                    </div>
		                    <div class="aui-list-item-text">
						                      婚纱摄影《山茶花系列》优美的环境，魅力四射
		                    </div>
		                </div>
		            </div>
		            <div class="aui-info " style="padding-top:0">
			            <div class="aui-info-item">2015-07-14 10:31 </div>
			            <div class="aui-info-item">
			            	<i class="iconfont icon-dianhua-copy aui-margin-t-5 jinrong-dianh"></i>
			            	<i class="iconfont icon-qq aui-margin-l-10"></i>
			            </div>
		            </div>
		        </li>
		    </ul>
		</div>
		-->
	</div>
	<div class="aui-card-list-footer aui-text-center" id="cd_loading">查看更多</div>   
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<script type="text/javascript" src="../../script/aui-scroll.js"></script>
<script type="text/javascript" src="../../script/swiper.min.js"></script>
<script>
var db_key = 'user',db_user,useParam={},nowpage=1, loadend=false, isloading=false,status=0;
//初始化    
apiready = function() {
	//加载头部轮播图
	var sliderbigarr = {rtk: RSapi.myrtk, cate:8};
	loaddata('shenghuoslider',sliderbigarr,RSapi.base+RSapi.allSlider,'shenghuoSlider','1');
    //加载分类
    loaddata('shenghuocate',sliderbigarr,RSapi.base+RSapi.shenghuoCate,'shenghuoCate','0');
    //加载列表
    loadlist(1);
}
//监听滚动高度，加载下一页	
var scroll = new auiScroll({
    listen:true, //是否监听滚动高度，开启后将实时返回滚动高度
    distance:10 //判断到达底部的距离，isToBottom为true
},function(ret){
    if (ret.isToBottom) {
        loadlist(1);//显示更多数据
    }
});
//筛选
function shaixuan(obj,type){
	//改变筛选按钮样式
	var $shaixuan_dom = $api.domAll(".cd_shaixuan");
	for (var j = 0; j < $shaixuan_dom.length; j++) {
		$api.removeCls($shaixuan_dom[j], 'zhmx-active');
	}
	$api.addCls(obj,'zhmx-active');
	status = type;//筛选参数值改变
	nowpage=1;//页码重新等于1
	loadend=false;
	loadlist(2);//重新加载数据
} 
//加载分类列表
function loaddata(status,param,url,domid,flag) {
	api.ajax({
		url: url,
		method: 'post',
		cache: false,
		timeout: 30,
		dataType: 'json',
		data: { values: param },
	}, function(ret, err){
		if(err){
			api.alert({msg: err.msg});
		}else {
			if (ret.status>0) {
				//成功了
				$api.html($api.byId(domid), ' ');
				$api.append($api.byId(domid),ret.info);
				if(flag == 1){
					sliderBig();//大轮播图
				}
				api.parseTapmode();
				eval('status_'+status+'=true;');
			}else {
				//失败了
				api.toast({msg: ret.info});
			}
		}
	});
}
//加载内容列表
function loadlist(flag) {
	if (loadend) {/*api.toast({msg:'1'});*/return;}
    //禁止重复加载
    if (isloading) {/*api.toast({msg:'2'});*/return;}
    else isloading = true;
    api.showProgress();//显示加载进度框
    $api.removeCls($api.byId("cd_loading"),'none');//显示加载中

    useParam.page = nowpage;
	useParam.rtk = RSapi.myrtk;		
	useParam.cid = status;

	api.ajax({
		url: RSapi.base+RSapi.shenghuoList,
		method: 'post',
		cache: false,
		timeout: 30,
		dataType: 'json',
		data: { values: useParam },
	}, function(ret, err){
		if(err){
			//api.toast({msg: JSON.stringify(err)});
			api.alert({msg: err.msg});
		}else {
			if (ret.status==1) { 
				//成功了
				nowpage++;//页数加一
				if(flag == 1){ 
					$api.append($api.byId('shenghuoList'),ret.info);
				}else if(flag == 2){
					$api.html($api.byId('shenghuoList'),ret.info);
				}		
//				$api.addCls($api.byId('wudongtai_box'), 'none');//显示无动态框		
				api.parseTapmode();
				eval('status_'+status+'=true;');
			}else if(ret.status==2){
				//没有内容
				$api.html($api.byId('shenghuoList'),'');
				loadend = true;
//				$api.removeCls($api.byId('wudongtai_box'), 'none');//显示无动态框
//				$api.html($api.byId('wudongtai_txt'), ret.info);//显示提示内容
			}else if(ret.status==3){
				//成功了, 但是已经加载完毕
                loadend = true;
                api.toast({msg:ret.info});
			}else {
				//失败了
				api.toast({msg: ret.info});
			}
		}
//		$api.addCls($api.byId("cd_loading"),'none');//隐藏加载中
		isloading = false;//加载结束
	});
	api.hideProgress();
}
//大轮播图
function sliderBig(){
	var swiper = new Swiper('.swiper-container', {
        pagination: '.swiper-pagination',
        nextButton: '.swiper-button-next',
        prevButton: '.swiper-button-prev',
        paginationClickable: true,
        spaceBetween: 30,
        centeredSlides: true,
        autoplay: 2500,
        autoplayDisableOnInteraction: false
    });
}
//打开金融、影视娱乐、生活详情
function openXinxiinfo(id,title,type){
    api.openWin({
	        name: 'win_xinxiinfo',
	        url: '../win/xinxiinfo_win.html',
	        pageParam: {infoid: id,pagetitle:title,infotype:type}
        });
}   
</script>
</html>